package ru.gerunn;

import java.net.MalformedURLException;

import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbException;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFilenameFilter;

public class LogProvider {
	private SmbFile[] files;
	
	LogProvider(String dir, String prefix) throws MalformedURLException, SmbException {
		NtlmPasswordAuthentication ntlmPasswordAuthentication = NtlmPasswordAuthentication.ANONYMOUS;
		SmbFile smbFile = new SmbFile(dir, ntlmPasswordAuthentication);
		if (smbFile.exists()) {
			SmbFilenameFilter smbFilenameFilter = new LogFilter(prefix);
			this.files = smbFile.listFiles(smbFilenameFilter);
		}
	}

	public SmbFile[] getFiles() {
		return files;
	}
}
